var __extends =
    (this && this.__extends) ||
    (function () {
      var n = function (i, t) {
        return (n =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (n, i) {
              n.__proto__ = i;
            }) ||
          function (n, i) {
            for (var t in i)
              Object.prototype.hasOwnProperty.call(i, t) && (n[t] = i[t]);
          })(i, t);
      };
      return function (i, t) {
        function e() {
          this.constructor = i;
        }
        if ("function" != typeof t && null !== t)
          throw new TypeError(
            "Class extends value " + String(t) + " is not a constructor or null"
          );
        n(i, t),
          (i.prototype =
            null === t
              ? Object.create(t)
              : ((e.prototype = t.prototype), new e()));
      };
    })(),
  AXTrainingHallView = (function (n) {
    function i() {
      var i = n.call(this) || this;
      return (
        (i.onLoadXunLianHomeData = {
          caller: i,
          code: 1204,
          method: function (n) {
            (i.trainArr = []), (i.dataArr = n.list);
            for (var t, e = 0; e < n.list.length; e++)
              (t = { label_training_name: { text: n.list[e].name } }),
                i.trainArr.push(t);
            i.list_training_hall.dataSource = i.trainArr;
          },
        }),
        (i.onLoadJieShouXunLianFn = {
          caller: i,
          code: 1205,
          method: function (n) {
            0 == n.code
              ? "3" == n.data.k
                ? ((i.btn_training_xunlian.visible = !1),
                  (i.btn_training_lingqu.visible = !0),
                  (i.label_training_state.visible = !0),
                  (i.label_training_state.text = n.data.v),
                  (i.label_training_state.align = "center"),
                  Laya.stage.event("GameMainView", "exp"),
                  Laya.stage.event("HomePageView", "exp"))
                : "2" == n.data.k || "1" == n.data.k
                ? ((i.btn_training_xunlian.visible = !1),
                  (i.label_training_state.visible = !0),
                  (i.btn_training_lingqu.visible = !1),
                  (i.label_training_state.text = n.data.v),
                  (i.label_training_state.align = "center"))
                : "0" == n.data.k &&
                  ((i.btn_training_lingqu.visible = !1),
                  (i.btn_training_xunlian.visible = !0),
                  (i.label_training_state.visible = !1),
                  TrainDetailDialog.showTrainDetail(n.data.v))
              : ((i.label_training_state.visible = !0),
                (i.label_training_state.text = n.msg),
                (i.btn_training_xunlian.visible = !1));
          },
        }),
        (i.onLoadLingQuDataFn = {
          caller: i,
          code: 1208,
          method: function (n) {
            0 == n.code
              ? (ToastView.toastView(n.data),
                WebSocketService.send({ c: 1205, d: null }),
                Laya.stage.event("GameMainView", "exp"),
                Laya.stage.event("HomePageView", "exp"))
              : ToastView.toastView(n.msg);
          },
        }),
        i.btn_training_xunlian.on(
          Laya.Event.CLICK,
          i,
          i.onTraningXunLianDidClickFn
        ),
        i.btn_training_shuoming.on(
          Laya.Event.CLICK,
          i,
          i.onTraningShuoMingDidClickFn
        ),
        i.btn_training_cancle.on(Laya.Event.CLICK, i, i.onTrainingClose),
        WebSocketService.addListener(i.onLoadXunLianHomeData, !0),
        WebSocketService.addListener(i.onLoadJieShouXunLianFn),
        WebSocketService.addListener(i.onLoadLingQuDataFn, !0),
        (i.list_training_hall.selectEnable = !0),
        (i.list_training_hall.vScrollBarSkin = ""),
        i.list_training_hall.on(
          Laya.Event.CLICK,
          i,
          i.onTraningHallLookDetailFn
        ),
        i.tab_training_hall.on(Laya.Event.CLICK, i, i.onActionTrainingHallFn),
        i.btn_training_lingqu.on(
          Laya.Event.CLICK,
          i,
          i.onTraingLingQuDidClickFn
        ),
        i
      );
    }
    return (
      __extends(i, n),
      (i.openView = function () {
        return (
          null == this.traningVC && (this.traningVC = new i()),
          (this.traningVC.btn_training_xunlian.visible = !0),
          (this.traningVC.label_training_state.visible = !1),
          (this.traningVC.btn_training_lingqu.visible = !1),
          WebSocketService.send({ c: 1204, d: { t: 1 } }),
          WebSocketService.send({ c: 1205, d: null }),
          this.traningVC
        );
      }),
      (i.prototype.onTraingLingQuDidClickFn = function () {
        WebSocketService.send({ c: 1208, d: null });
      }),
      (i.prototype.onActionTrainingHallFn = function (n) {
        "item0" == n.target.name
          ? WebSocketService.send({ c: 1204, d: { t: 1 } })
          : "item1" == n.target.name &&
            WebSocketService.send({ c: 1204, d: { t: 2 } });
      }),
      (i.prototype.onTraningHallLookDetailFn = function (n) {
        if ("" != n.target.name) {
          var i = this.dataArr[this.list_training_hall.selectedIndex].id;
          FriendsDetailDialog.showFriendDialog(i, !0);
        }
      }),
      (i.prototype.onTraningXunLianDidClickFn = function (n) {
        "训练" == n.target.label && WebSocketService.send({ c: 1205, d: null });
      }),
      (i.prototype.onTraningShuoMingDidClickFn = function () {
        TraninDescribleDialog.showTraDescr();
      }),
      (i.prototype.onTrainingClose = function () {
        this.removeSelf();
      }),
      i
    );
  })(ui.SubSquareController.AXTrainingHallViewUI);
